<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib uri="/struts-tags" prefix="s" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>杯具</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link rel="stylesheet" type="text/css" href="css/main.css"/>
	<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
	    <script type="text/javascript">
	    function refresh(){
			location.href="page/sys/getToNotice.action?FN=FN020110";
    	};
    	function toAddNotice(){
			location.href="addNotice.jsp";
        }
	    	$(document).ready(function(){
				$('input#checkAll').change(function(){
					$('input[name="checkboxToNot"]').each(function(){
						$(this).attr('checked',$('input#checkAll').attr('checked'));
					});
				});
				$('input#updateUser').click(function(){
	  			  	var userList = new Array();
			 	 	var num = 0;
					$('input[name="checkboxToNot"]').each(function(i){
						if($(this).attr('checked')){
							userList[num++] = $(this).val();
						}
					});
					if(userList.length==0){
						alert('请选择');
						return;
					}else if(userList.length>1){
						alert('只能选择一个');
						return;
					}
					location.href="findNoticeById.action?notId="+encodeURIComponent(userList[0]);
	  	  	 	});
	  	  	 	$('input#delete').click(function(){
	  	  	  		var question = confirm("你确认要删除所选信息?");
	  		  	  	if(question!='0'){
	  	  	  	 	 	var userList = new Array();
	  	  	  		  	var num = 0;
	  					$('input[name="checkboxToNot"]').each(function(i){
	  						if($(this).attr('checked')){
	  							userList[num++] = $(this).val();
	  						}
	  					});
	  					var url = "deleteNotice.action";
	  					if(userList.length>=1){
	  						for(var z = 0; z < userList.length;z++){
	  							if(z==0){
	  								url += "?deleteNoticeId="+userList[z];
	  							}else{
	  								url += "&deleteNoticeId="+userList[z];
	  							}
	  						}
	  					}
	  					location.href=url;
	  		  	  	}
	  	  		});
		    });
		    
	    </script>
  </head>
  
    <body>
    <div class="mainContainer">
	<div class="headerTitle">日常信息管理&nbsp;>>&nbsp;制度发布</div>
	<div class="dataDivLeftNoTree">
		
   
<table class="gridTable" border="0" cellspacing="0" cellpadding="0">
	<tr class="operatorAction">
		<td>
			<!-- 功能性操作 -->
			
			<input type="button" style="margin-left:2px;" value="刷新" onclick="refresh()"/>
			<input type="button" style="margin-left:2px;" value="新增" onclick="toAddNotice()"/>
			<input type="button" style="margin-left:2px;" value="修改" id="updateUser"/>
			<input type="button" style="margin-left:2px;" value="删除" id="delete"/>
			查询条件：根据&nbsp;&nbsp;<select style="width: 94px;"  id="condition">
		  					<option value="ygbh">用户编号</option>
		  					<option selected="selected" value="ygxm">留言名称</option>
		  				</select><input style="margin-left:10px;" type="text" id="conditionValue"/>
		  	<input type="button" style="margin-left:1px;" value="查询" onclick="queryStaff()"/>
			
		</td>
	</tr>
	<tr>
		<td class="gridData">
		
	        <table class="dataTable" border="0" cellpadding="0" cellspacing="1">
	          <tr class="dataHeader">
	          	<!-- 数据表头 -->
	          	
	            <td width="6%"><input id="checkAll" type="checkbox" name="check" value="checkbox" /></td>
	            <td width="8%">公告编号</td>
	            <td width="14%">公告名称</td>
	            <td width="37%">公告正文</td>
	            <td width="10%">发布用户</td>
	            <td width="10%">发布时间</td>
	            <td width="7%">附件</td>
	            <td width="7%">状态</td>
	          </tr>
	          <!-- 数据 -->
	         <s:iterator var="sta" value="pagination.dataList" status="st"> 
	         
	          <tr class="dataRow">
	            <td><input name="checkboxToNot" type="checkbox" value="<s:property value='#sta.notid'/>" id="selectItem" /></td>
	            <td><s:property value="#st.index+1"/></td>
	            <td><s:property value="#sta.nottitle"/></td>
	            <td><s:property value="#sta.notbody"/></td>
	            <td><s:property value="#sta.notuser"/></td>
	            <td>
	               <fmt:formatDate value="${sta.notdate}" pattern="yyyy/MM/dd"/>
	            </td>
	            <td><s:if test="#sta.noturl!=null"><a href="<%=basePath%>downloadnotice.action?downloadUrl=<s:property value="#sta.noturl"/>&notURLFileName=<s:property value="#sta.notname"/>">下载附件</a></s:if><s:else>无</s:else></td>
	            <td><s:if test="#sta.notstatus==\"Y\"">在用</s:if><s:else>停用</s:else></td>
	          </tr>
	      	</s:iterator>
			</table>
		</td>
	</tr>
	   <!-- 分页 -->
              <tr class="dataPager">
				<td>
					<s:property value="pageLink" escapeHtml="false" />
				</td>
			</tr>
</table>
    	</div>
</div>
  </body>
</html>
